<template>
  <div class="wrapper">
    <div class="audit-card">
      <el-form
        label-position="right"
        :model="formData"
        class="comp-form"
        :inline="true"
        :rules="rules"
        ref="ruleForm"
        :disabled="mode === 'detail'"
        validate-on-rule-change
      >
        <div class="cardWrap">
          <el-row :gutter="24">
            <el-col :span="8">
              <el-form-item label="审计类型" prop="audit_type">
                <el-select v-model="formData.audit_type" style="width: 191px">
                  <el-option
                    v-for="item in auditTypeData"
                    :key="item.id"
                    :label="item.label"
                    :value="item.id + ''"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8" v-if="formData.audit_type === '2'">
              <el-form-item label="审计客户" prop="audit_customer_id">
                <el-select
                  style="width: 191px"
                  placeholder="请搜索"
                  v-model="formData.audit_customer_id"
                  filterable
                  remote
                  :remote-method="remoteAuditCustomer"
                >
                  <el-option
                    v-for="item in auditCustomerData"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id + ''"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8" v-if="formData.audit_type === '3'">
              <el-form-item
                :required="formData.audit_type === '3'"
                label="审计承运商"
                prop="audit_carrier_id"
              >
                <el-select
                  style="width: 177px"
                  placeholder="请搜索"
                  v-model="formData.audit_carrier_id"
                  filterable
                  remote
                  :remote-method="remoteAuditCarrier"
                >
                  <el-option
                    v-for="item in auditCarrierData"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id + ''"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8" v-if="formData.audit_type !== '3'">
              <el-form-item
                :required="formData.audit_type !== '3'"
                label="审计项目"
                prop="audit_project"
              >
                <div>
                  <el-input
                    style="width: 191px"
                    v-model="formData.audit_project"
                  ></el-input>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="24" v-if="formData.audit_type === '2'">
              <div class="maxWidth">
                <el-form-item
                  :required="formData.audit_type === '2'"
                  label="业务描述"
                  prop="business_desc"
                >
                  <el-input
                    style="width: 1071px"
                    type="textarea"
                    v-model="formData.business_desc"
                  ></el-input>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="8">
              <el-form-item required label="审计时间" prop="audit_time">
                <div>
                  <el-date-picker
                    style="width: 191px"
                    v-model="formData.audit_time"
                    type="datetime"
                    value-format="timestamp"
                    placeholder="选择日期时间"
                    default-time="12:00:00"
                    @change="changeAuditTime"
                  >
                  </el-date-picker>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="审计计划" prop="audit_plan">
                <div>
                  <el-input
                    style="width: 191px"
                    v-model="formData.audit_plan"
                  ></el-input>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="审计内容" prop="audit_content">
                <div>
                  <el-input
                    style="width: 191px"
                    v-model="formData.audit_content"
                  ></el-input>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="8" v-if="formData.audit_type !== '3'">
              <el-form-item
                :required="formData.audit_type !== '3'"
                label="审计方"
                prop="auditee"
              >
                <div>
                  <el-input
                    style="width: 191px; margin-left: 14px"
                    v-model="formData.auditee"
                  ></el-input>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="8" v-else>
              <el-form-item
                :required="formData.audit_type === '3'"
                label="审计人"
                prop="audit_user_id"
              >
                <el-select
                  style="width: 191px; margin-left: 14px"
                  placeholder="请搜索"
                  v-model="formData.audit_user_id"
                  filterable
                  remote
                  :remote-method="remoteAuditPerson"
                >
                  <el-option
                    v-for="item in auditPersonData"
                    :key="item.id"
                    :label="item.nickname"
                    :value="item.id + ''"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8" v-if="formData.audit_type === '2'">
              <el-form-item
                :required="formData.audit_type === '2'"
                label="审计方式"
                prop="audit_method"
              >
                <el-select style="width: 191px" v-model="formData.audit_method">
                  <el-option
                    v-for="item in auditMethodData"
                    :key="item.id"
                    :label="item.label"
                    :value="item.id + ''"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8" v-if="formData.audit_type === '2'">
              <el-form-item
                :required="formData.audit_type === '2'"
                label="销售"
                prop="sale_id"
              >
                <el-select
                  style="width: 191px; margin-left: 28px"
                  placeholder="请搜索"
                  v-model="formData.sale_id"
                  filterable
                  remote
                  :remote-method="remoteSaler"
                >
                  <el-option
                    v-for="item in salerData"
                    :key="item.id"
                    :label="item.nickname"
                    :value="item.id + ''"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="所属区域" prop="branch_id">
                <el-select
                  style="width: 191px"
                  v-model="formData.branch_id"
                  filterable
                  remote
                  :remote-method="remoteBranch"
                >
                  <el-option
                    v-for="item in branchData"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id + ''"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="审计材料" prop="audit_materials">
                <UploadLink :files.sync="formData.audit_materials"></UploadLink>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="审计报告" prop="audit_report">
                <UploadLink :files.sync="formData.audit_report"></UploadLink>
              </el-form-item>
            </el-col>
            <el-col :span="24" v-if="formData.audit_type === '3'">
              <el-form-item
                :required="formData.audit_type === '3'"
                label="质量协议"
                prop="quality_agreement"
              >
                <UploadLink
                  :files.sync="formData.quality_agreement"
                ></UploadLink>
              </el-form-item>
            </el-col>
          </el-row>
        </div>
        <div class="cardWrap bottomNone">
          <el-row :gutter="24">
            <el-col :span="8">
              <el-form-item label="应复审日期" prop="review_time">
                <div>
                  <el-date-picker
                    v-model="formData.review_time"
                    type="datetime"
                    value-format="timestamp"
                    placeholder="选择日期时间"
                    default-time="12:00:00"
                    style="width: 100%"
                    @change="changeReviewTime"
                  >
                  </el-date-picker>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="通知负责人复审日期" prop="notice_time">
                <div>
                  <el-date-picker
                    v-model="formData.notice_time"
                    type="datetime"
                    value-format="timestamp"
                    placeholder="选择日期时间"
                    default-time="12:00:00"
                    style="width: 100%"
                  >
                  </el-date-picker>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="负责人" prop="leader_id">
                <el-select
                  style="width: 191px; margin-left: 14px"
                  placeholder="请搜索"
                  v-model="formData.leader_id"
                  filterable
                  remote
                  :remote-method="remoteOwner"
                >
                  <el-option
                    v-for="item in ownerData"
                    :key="item.id"
                    :label="item.nickname"
                    :value="item.id + ''"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
        </div>
        <div class="cardWrap finding" style="font-size: 14px; color: #606266">
          <el-row :gutter="15">
            <el-col :span="6">
              <el-form-item label="审计发现项" prop="finding"></el-form-item
            ></el-col>
            <el-col :span="4"
              ><el-form-item label="是否整改" prop="is_rectify"></el-form-item
            ></el-col>
            <el-col :span="3">
              <el-form-item label="凭证" prop="proof"></el-form-item
            ></el-col>
            <el-col :span="3"></el-col>
          </el-row>
          <el-row
            style="margin-bottom: 15px"
            :gutter="15"
            v-for="(item, index) in formData.finding"
            :key="index"
          >
            <el-col :span="6">
              <div style="margin: 2px 0">
                <el-input
                  style="width: 284px"
                  v-model="item.finding"
                ></el-input>
              </div>
            </el-col>
            <el-col :span="4">
              <div style="margin: 6px 0">
                <el-radio v-model="item.is_rectify" label="1">是</el-radio>
                <el-radio v-model="item.is_rectify" label="0">否</el-radio>
              </div>
            </el-col>
            <el-col :span="2">
              <UploadLink :files.sync="item.proof"></UploadLink
            ></el-col>
            <el-col :span="3"
              ><i
                class="el-icon-circle-plus-outline"
                style="font-size: 30px; color: #a6a6a6; margin-right: 10px"
                @click="addFinding"
              ></i
              ><i
                class="el-icon-remove-outline"
                style="font-size: 30px; color: #a6a6a6"
                @click="deleteFinding(index)"
              ></i
            ></el-col>
          </el-row>
        </div>
      </el-form>
    </div>
    <div class="operation-footer">
      <div class="footer-wrap">
        <el-button size="small" @click="handleClickClose">关闭</el-button>
        <el-button
          v-if="mode !== 'detail'"
          size="small"
          type="primary"
          @click="handleOperation('1')"
          >保存</el-button
        >
        <el-button
          v-if="formData.status !== '1'"
          size="small"
          type="primary"
          @click="handleOperation('2')"
          >审计通过</el-button
        >
        <el-button
          v-if="formData.audit_type === '3' && formData.status !== '2'"
          size="small"
          type="primary"
          @click="handleOperation('3')"
          >驳回</el-button
        >
      </div>
    </div>
  </div>
</template>

<script>
import UploadLink from "@/components/uploadFile/uploadLink.vue";
import { customerPeople, carrierID, website_list } from "@/api/information";
import { AdminBox } from "@/api/customer";
import {
  reqAddAudit,
  reqAuditDetail,
  reqAdoptAudit,
  reqUpdateAudit,
  reqRejectAudit,
} from "@/api/qms";
export default {
  name: "auditEdit",
  components: { UploadLink },
  props: [],
  data() {
    //审计承运商
    var validatePass = (rule, value, callback) => {
      if (value === "") {
        if (this.formData.audit_type === "3") {
          callback(new Error("请选择审计承运商"));
        } else {
          callback();
        }
      } else {
        callback();
      }
    };
    //审计项目
    var validatePass1 = (rule, value, callback) => {
      if (value === "") {
        if (this.formData.audit_type !== "3") {
          callback(new Error("请填写审计项目"));
        } else {
          callback();
        }
      } else {
        callback();
      }
    };
    //业务描述
    var validatePass2 = (rule, value, callback) => {
      if (value === "") {
        if (this.formData.audit_type === "2") {
          callback(new Error("请填写业务描述"));
        } else {
          callback();
        }
      } else {
        callback();
      }
    };
    //审计方
    var validatePass3 = (rule, value, callback) => {
      if (value === "") {
        if (this.formData.audit_type !== "3") {
          callback(new Error("请填写审计方"));
        } else {
          callback();
        }
      } else {
        callback();
      }
    };
    //审计人
    var validatePass4 = (rule, value, callback) => {
      if (value === "") {
        if (this.formData.audit_type === "3") {
          callback(new Error("请选择审计人"));
        } else {
          callback();
        }
      } else {
        callback();
      }
    };
    //审计方式
    var validatePass5 = (rule, value, callback) => {
      if (value === "") {
        if (this.formData.audit_type === "2") {
          callback(new Error("请选择审计方式"));
        } else {
          callback();
        }
      } else {
        callback();
      }
    };
    //销售
    var validatePass6 = (rule, value, callback) => {
      if (value === "") {
        if (this.formData.audit_type === "2") {
          callback(new Error("请选择销售"));
        } else {
          callback();
        }
      } else {
        callback();
      }
    };
    //质量协议
    var validatePass7 = (rule, value, callback) => {
      if (value.length === 0) {
        if (this.formData.audit_type === "3") {
          callback(new Error("请上传质量协议"));
        } else {
          callback();
        }
      } else {
        callback();
      }
    };
    //审计发现项
    var validatePass8 = (rule, value, callback) => {
      if (this.formData.finding.some((item) => item.finding === "")) {
        if (this.passFlag) {
          callback(new Error("请填写审计发现项"));
        } else {
          callback();
        }
      } else {
        callback();
      }
    };
    //是否整改
    var validatePass9 = (rule, value, callback) => {
      if (this.formData.finding.some((item) => item.is_rectify === "0")) {
        if (this.passFlag) {
          callback(new Error("此项需要为是"));
        } else {
          callback();
        }
      } else {
        callback();
      }
    };
    //凭证
    var validatePass10 = (rule, value, callback) => {
      if (this.formData.finding.some((item) => item.proof.length === 0)) {
        if (this.passFlag) {
          callback(new Error("请上传凭证"));
        } else {
          callback();
        }
      } else {
        callback();
      }
    };
    return {
      mode: "",
      passFlag: false,
      formData: {
        audit_type: "0", // 审计类型 0内部审计 1第三方审计 2客户审计
        audit_customer_id: "", // 审计客户id
        audit_carrier_id: "", // 审计承运商id
        audit_user_id: "", // 审计人id
        quality_agreement: [], // 质量协议
        business_desc: "", // 业务描述
        sale_id: "", // 销售id
        audit_method: "", // 审计方式 0无 1远程审计 2现场审计
        audit_project: "", // 审计项目
        audit_time: new Date().getTime(), // 审计时间
        audit_plan: "", // 审计计划
        audit_content: "", // 审计内容
        auditee: "", // 审计方
        branch_id: "", // 所属区域id
        leader_id: "", // 负责人id
        audit_materials: [], // 审计材料
        audit_report: [], // 审计报告
        review_time: "", // 复审时间
        notice_time: "", // 通知负责人复审时间
        finding: [
          {
            finding: "",
            is_rectify: "0",
            proof: [],
          },
        ], // 发现项
        is_pass: "0", // 是否通过 0不通过  1审计通过
      },
      rules: {
        audit_type: [
          { required: true, message: "请选择审计类型", trigger: "change" },
        ],
        audit_customer_id: [
          { required: true, message: "请选择审计客户", trigger: "change" },
        ],
        audit_carrier_id: [
          {
            validator: validatePass,
            trigger: "change",
          },
        ],
        audit_project: [
          {
            validator: validatePass1,
            trigger: "blur",
          },
        ],
        business_desc: [
          {
            validator: validatePass2,
            trigger: "blur",
          },
        ],
        audit_plan: [
          { required: true, message: "请填写审计计划", trigger: "blur" },
        ],
        audit_content: [
          { required: true, message: "请填写审计内容", trigger: "blur" },
        ],
        auditee: [
          {
            validator: validatePass3,
            trigger: "blur",
          },
        ],
        audit_user_id: [
          {
            validator: validatePass4,
            trigger: "change",
          },
        ],
        audit_method: [
          {
            validator: validatePass5,
            trigger: "change",
          },
        ],
        sale_id: [
          {
            validator: validatePass6,
            trigger: "change",
          },
        ],
        branch_id: [
          { required: true, message: "请选择所属区域", trigger: "change" },
        ],
        audit_materials: [
          {
            type: "array",
            required: true,
            message: "请至少上传一份审计材料",
            trigger: "change",
          },
        ],
        audit_report: [
          {
            type: "array",
            required: true,
            message: "请至少上传一份审计报告",
            trigger: "change",
          },
        ],
        quality_agreement: [
          {
            validator: validatePass7,
            trigger: "change",
          },
        ],
        review_time: [
          { required: true, message: "请选择应复审日期", trigger: "change" },
        ],
        notice_time: [
          {
            required: true,
            message: "请选择通知负责人复审日期",
            trigger: "change",
          },
        ],
        leader_id: [
          { required: true, message: "请选择负责人", trigger: "blur" },
        ],
        finding: [
          {
            validator: validatePass8,
            trigger: "blur",
          },
        ],
        is_rectify: [
          {
            validator: validatePass9,
            trigger: "change",
          },
        ],
        proof: [
          {
            validator: validatePass10,
            trigger: "change",
          },
        ],
      },
      auditTypeData: [
        {
          id: "0",
          label: "内部审计",
        },
        {
          id: "1",
          label: "第三方审计",
        },
        {
          id: "2",
          label: "客户审计",
        },
        {
          id: "3",
          label: "承运商审计",
        },
      ],
      auditCustomerData: [], //审计客户
      auditCarrierData: [], //审计承运商
      auditPersonData: [], //审计人
      auditMethodData: [
        { id: "1", label: "远程审计" },
        { id: "2", label: "现场审计" },
      ],
      salerData: [], //销售
      branchData: [], //区域
      ownerData: [], //负责人
    };
  },
  async mounted() {
    await this.carrierIDData();
    if (this.mode !== "edit" && this.mode !== "detail") {
      this.formData.review_time = new Date().setFullYear(
        new Date().getFullYear() + 1
      );
      this.formData.notice_time = new Date().setMonth(
        new Date().getMonth() + 11
      );
    }

    if (this.auditCustomerData.length === 0) {
      let result = await customerPeople({
        name: "",
        is_send: "1",
        is_receive: "",
      });
      this.auditCustomerData = result.data;
    }

    if (this.branchData.length === 0) {
      let result = await website_list({
        branch_type: "3",
        name: "",
      });
      this.branchData = result.data;
    }

    if (this.auditCarrierData.length === 0) {
      let result = await carrierID({
        name: "",
        is_audit: true,
      });
      this.auditCarrierData = result.data;
    }

    if (
      this.auditPersonData.length === 0 ||
      this.salerData.length === 0 ||
      this.ownerData.length === 0
    ) {
      let result = await AdminBox({
        user_type: "0",
        nickname: "",
      });
      this.auditPersonData = result.data;
      this.salerData = result.data;
      this.ownerData = result.data;
    }
    if (this.$route.query.audit_carrier_id) {
      // console.log(this.auditCarrierData, "this.auditCarrierData");
      this.formData.audit_carrier_id =
        this.$route.query.audit_carrier_id + "" || "";
    }
  },
  watch: {
    $route: {
      handler: function () {
        // console.log(this.auditCustomerData, "======");
        this.mode = this.$route.query.mode || "";
        this.formData.audit_type = this.$route.query.audit_type || "0";
        // this.formData.audit_carrier_id =
        // this.$route.query.audit_carrier_id || "";
        // // console.log( this.formData.audit_carrier_id,
        // " this.formData.audit_carrier_id")
        this.handleChangeMode();
        // location.reload();
      },
      immediate: true,
      deep: true,
    },
  },
  methods: {
    changeAuditTime(val) {
      let date1 = new Date(val);
      let date2 = new Date(val);
      this.formData.review_time = date1.setFullYear(date1.getFullYear() + 1);
      this.formData.notice_time = date2.setMonth(date2.getMonth() + 11);
    },
    changeReviewTime(val) {
      let date = new Date(val);
      this.formData.notice_time = date.setMonth(date.getMonth() - 1);
    },
    handleClickClose() {
      this.$router.push({
        name: "auditlist",
      });
    },
    async handleOperation(val) {
      if (val === "1") {
        this.formData.audit_time = (this.formData.audit_time + "").slice(0, 10);
        this.formData.review_time = (this.formData.review_time + "").slice(
          0,
          10
        );
        this.formData.notice_time = (this.formData.notice_time + "").slice(
          0,
          10
        );
        let result;
        if (this.mode === "add") {
          result = await reqAddAudit(this.formData);
          if (result.code == 10000) {
            this.$message({ type: "success", message: "保存成功！" });
            this.handleClickClose();
          } else {
            this.formData.audit_time = this.formData.audit_time * 1000;
            this.formData.review_time = this.formData.review_time * 1000;
            this.formData.notice_time = this.formData.notice_time * 1000;
          }
        } else {
          result = await reqUpdateAudit(this.formData);
          if (result.code == 10000) {
            this.$message({ type: "success", message: "保存成功！" });
            this.handleClickClose();
          } else {
            this.formData.audit_time = this.formData.audit_time * 1000;
            this.formData.review_time = this.formData.review_time * 1000;
            this.formData.notice_time = this.formData.notice_time * 1000;
          }
        }
      } else {
        this.passFlag = val === "2" ? true : false;
        this.$refs["ruleForm"].validate(async (valid) => {
          if (valid) {
            if (val === "2") {
              this.formData.audit_time = (this.formData.audit_time + "").slice(
                0,
                10
              );
              this.formData.review_time = (
                this.formData.review_time + ""
              ).slice(0, 10);
              this.formData.notice_time = (
                this.formData.notice_time + ""
              ).slice(0, 10);
              let result1;
              if (this.mode === "add") {
                result1 = await reqAddAudit(this.formData);
                this.$set(this.formData, "id", result1.data.id);
              } else {
                result1 = await reqUpdateAudit(this.formData);
              }
              if (result1.code == 10000) {
                let result = await reqAdoptAudit({
                  id: this.formData.id,
                });
                if (result.code == 10000) {
                  this.$message({ type: "success", message: "操作成功！" });
                  this.handleClickClose();
                }
              } else {
                this.formData.audit_time = this.formData.audit_time * 1000;
                this.formData.review_time = this.formData.review_time * 1000;
                this.formData.notice_time = this.formData.notice_time * 1000;
              }
            } else if (val === "3") {
              this.formData.audit_time = (this.formData.audit_time + "").slice(
                0,
                10
              );
              this.formData.review_time = (
                this.formData.review_time + ""
              ).slice(0, 10);
              this.formData.notice_time = (
                this.formData.notice_time + ""
              ).slice(0, 10);
              let result1;
              if (this.mode === "add") {
                result1 = await reqAddAudit(this.formData);
                this.$set(this.formData, "id", result1.data.id);
              } else {
                result1 = await reqUpdateAudit(this.formData);
              }
              if (result1.code == 10000) {
                let result = await reqRejectAudit({
                  id: this.formData.id,
                });
                if (result.code == 10000) {
                  this.$message({ type: "success", message: "操作成功！" });
                  this.handleClickClose();
                }
              } else {
                this.formData.audit_time = this.formData.audit_time * 1000;
                this.formData.review_time = this.formData.review_time * 1000;
                this.formData.notice_time = this.formData.notice_time * 1000;
              }
            }
          } else {
            // console.log(valid, "error submit!!");
            return false;
          }
        });
      }
    },
    handleChangeMode() {
      if (this.mode === "add") {
        // this.initNewVersionFile();
      } else if (this.mode === "detail" || this.mode === "edit") {
        this.getDetail();
      }
    },
    async getDetail() {
      let result = await reqAuditDetail({ id: this.$route.query.id });
      if (result.code === 10000) {
        this.formData = result.data;
        this.formData.audit_time = this.formData.audit_time * 1000;
        this.formData.review_time = this.formData.review_time * 1000;
        this.formData.notice_time = this.formData.notice_time * 1000;
      }
    },
    addFinding() {
      if (this.mode === "detail") return;
      this.formData.finding.push({
        finding: "",
        is_rectify: "0",
        proof: [],
      });
    },
    deleteFinding(index) {
      if (this.formData.finding.length > 1 && this.mode !== "detail") {
        this.formData.finding.splice(index, 1);
      }
    },
    async remoteAuditCustomer(query) {
      if (query !== "") {
        let result = await customerPeople({
          name: query,
          is_send: "1",
          is_receive: "",
        });
        this.auditCustomerData = result.data;
      } else {
        this.auditCustomerData = [];
      }
    },
    async remoteAuditCarrier(query) {
      if (query !== "") {
        let result = await carrierID({
          name: query,
          is_audit: true,
        });
        this.auditCarrierData = result.data;
      } else {
        this.auditCarrierData = [];
      }
    },
    async remoteAuditPerson(query) {
      if (query !== "") {
        let result = await AdminBox({
          user_type: "0",
          nickname: query,
        });
        this.auditPersonData = result.data;
      } else {
        this.auditPersonData = [];
      }
    },
    async remoteSaler(query) {
      if (query !== "") {
        let result = await AdminBox({
          user_type: "0",
          nickname: query,
        });
        this.salerData = result.data;
      } else {
        this.salerData = [];
      }
    },
    async remoteBranch(query) {
      if (query !== "") {
        let result = await website_list({
          branch_type: "3",
          name: query,
        });
        this.branchData = result.data;
      } else {
        this.branchData = [];
      }
    },
    async remoteOwner(query) {
      if (query !== "") {
        let result = await AdminBox({
          user_type: "0",
          nickname: query,
        });
        this.ownerData = result.data;
      } else {
        this.ownerData = [];
      }
    },
    async carrierIDData() {
      let result = await carrierID({
        name: "",
        is_audit: true,
      });
      this.auditCarrierData = result.data;
    },
  },
};
</script>
<style lang="scss" scoped>
::v-deep .maxWidth {
  .el-form-item {
    display: block !important;
  }
  .el-form-item__content {
    width: 80%;
  }
}

::v-deep .finding {
  .el-form-item__error {
    position: relative !important;
    padding-top: 8px !important;
  }
}

::v-deep .bottomNone {
  .el-form-item {
    margin-bottom: 0 !important;
  }
}

::v-deep .el-form-item__error {
  width: max-content;
}
.wrapper {
  background-color: #f0f2f5;
  .cardWrap {
    height: 50%;
    background: #ffffff;
    margin: 10px 10px 10px 10px;
    padding: 20px;
    border-radius: 10px;
  }
}

/deep/.operation-footer {
  position: fixed;
  width: calc(100% - 180px);
  bottom: 0;
  background: white;
  box-sizing: border-box;
  padding: 15px 0;
  box-shadow: 0px -10px 20px -10px rgba(0, 0, 0, 0.07);
  z-index: 100;
  left: 180px;

  .footer-wrap {
    text-align: center;
  }
}
</style>